# $Id$
# Maintainer: Gaetan Bisson <bisson@archlinux.org>
# Contributor: Ionut Biru <ibiru@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Roman Kyrylych <roman@archlinux.org>
# Contributor: Damir Perisa <damir@archlinux.org>

pkgname=hddtemp
_origver=0.3-beta15
_patchver=${_origver}-52
pkgver=${_patchver//-/.}
pkgrel=2
pkgdesc="Gives you the temperature of your hard drive by reading S.M.A.R.T. information"
url='https://savannah.nongnu.org/projects/hddtemp/'
license=('GPL')
arch=('i686' 'x86_64')
source=("http://download.savannah.gnu.org/releases/${pkgname}/${pkgname}-${_origver}.tar.bz2"
        "http://ftp.debian.org/debian/pool/main/h/${pkgname}/${pkgname}_${_patchver}.diff.gz"
        'service')
sha1sums=('65393b0a4d9862c030c81702d95c1acd00da275b'
          'b9bcdd0537c1540e55e5056445b571ea61d5a4a3'
          '9b02e5bed22f81ceab2b69bae788a9a3aa5c2147')


build() {
	cd "${srcdir}/${pkgname}-${_origver}"

	patch -p1 -i "../${pkgname}_${_patchver}.diff"

	./configure \
		--prefix=/usr \
		--sbindir=/usr/bin \
		--mandir=/usr/share/man \
		--with-db-path="/usr/share/${pkgname}/hddtemp.db"

	make
}

package() {
	cd "${srcdir}/${pkgname}-${_origver}"

	make DESTDIR="${pkgdir}" install

	install -Dm644 "../${pkgname}-${_origver}/debian/hddtemp.db" "${pkgdir}/usr/share/${pkgname}/hddtemp.db"
	install -Dm644 '../service' "${pkgdir}/usr/lib/systemd/system/hddtemp.service"
}
